import request from "@/utils/request";

/**
 * post方法，对应post请求
 * @desc注册请求
 * @param {String} url [请求的url地址]
 * @param {Object} params [请求时携带的参数]
 */
export function userRejister(data) {
  return request({
   url: `/users/register`,
   method: 'post',
   data: data
  })
 }

 /**
  * get方法，对应get请求
  * @desc登录请求
  * @param {String} url [请求的url地址]
  * @param {Object} params [请求时携带的参数]
  */
 export function userInfo() {
  return request({
   url: `/profile/all`,
   method: 'get'
  })
 }

 export function Category() {
  return request({
   url: `/category`,
   method: 'get'
  })
 }
 export function addCategory(data) {
  return request({
   url: `/category/create`,
   method: 'post',
   data
  })
 }
 export function deleteCategory(id) {
  return request({
   url: `/category/${id}`,
   method: 'delete'
  })
 }

 export function getArticle(params) {
  return request({
    url: `/article`,
    method: 'get',
    params
   })
 }
//  添加文章
 export function addArticle(data) {
  return request({
   url: `/article/create`,
   method: 'post',
   data
  })
 }
